package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLd10;
import com.huizu.project.service.IProLd10Service;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 科技帮扶报告Controller
 * 
 * @author zhangmx
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/project/prold10")
public class ProLd10Controller extends BaseController
{
    @Autowired
    private IProLd10Service proLd10Service;

    /**
     * 查询科技帮扶报告列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold10:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLd10 proLd10)
    {
        startPage();
        List<ProLd10> list = proLd10Service.selectProLd10List(proLd10);
        return getDataTable(list);
    }

    /**
     * 导出科技帮扶报告列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold10:export')")
    @Log(title = "科技帮扶报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLd10 proLd10)
    {
        List<ProLd10> list = proLd10Service.selectProLd10List(proLd10);
        ExcelUtil<ProLd10> util = new ExcelUtil<ProLd10>(ProLd10.class);
        util.exportExcel(response, list, "科技帮扶报告数据");
    }

    /**
     * 获取科技帮扶报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prold10:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLd10Service.selectProLd10ById(id));
    }

    /**
     * 新增科技帮扶报告
     */
    @PreAuthorize("@ss.hasPermi('project:prold10:add')")
    @Log(title = "科技帮扶报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLd10 proLd10)
    {
        return toAjax(proLd10Service.insertProLd10(proLd10));
    }

    /**
     * 修改科技帮扶报告
     */
    @PreAuthorize("@ss.hasPermi('project:prold10:edit')")
    @Log(title = "科技帮扶报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLd10 proLd10)
    {
        return toAjax(proLd10Service.updateProLd10(proLd10));
    }

    /**
     * 删除科技帮扶报告
     */
    @PreAuthorize("@ss.hasPermi('project:prold10:remove')")
    @Log(title = "科技帮扶报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLd10Service.deleteProLd10ByIds(ids));
    }
}
